<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <style type="text/css">
        #imglist img{
            width: 300px;
            height: 200px;
        }
    </style>
</head>
<body>
     <div id="imglist">
         <img src="./imgs/mm001.jpg">
         <img src="./imgs/mm002.jpg">
         <img src="./imgs/mm003.jpg">
         <img src="./imgs/mm004.jpg">
         <img src="./imgs/mm004444.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm005.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm006.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm007.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm008.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm009.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm010.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm011.jpg">
         <img src="./imgs/mm012.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm00444342434.jpg">
         <img src="./imgs/mm013.jpg">
         <img src="./imgs/mm014.jpg">
         <img src="./imgs/mm015.jpg">
     </div>
   
<script>
    var imgs = document.getElementById("imglist").getElementsByTagName("img");
    for(var i in imgs){
        console.log(i);
        imgs[i].onerror = function(){
            this.src = "./imgs/error.jpg"
        }
    }
</script>
</html>